#include <stdarg.h>
#include <stdio.h>

static void
put_char_to_string( char c, void* p ) _REENTRANT {
  char **buf = ( char ** )p;
  *( *buf )++ = c;
}

int
vsprintf( char *buf, const char *format, va_list ap ) {
  int i;
  i = _print_format( put_char_to_string, &buf, format, ap );
  *buf = 0;
  return i;
}

int
sprintf( char *buf, const char *format, ... ) {
  va_list arg;
  int i;
  va_start( arg, format );
  i = _print_format( put_char_to_string, &buf, format, arg );
  *buf = 0;
  va_end( arg );
  return i;
}
